package edu.hcmus.sow.dao;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import edu.hcmus.sow.domain.FileRevisionComment;

/**
 * DAO to manage FileRevisionComment entities.
 * 
 */
@Repository
@Transactional
public class FileRevisionCommentDAOImpl extends AbstractHibernateDAO<FileRevisionComment, Integer> implements
      FileRevisionCommentDAO {

   public List<FileRevisionComment> getByFileRevisionID(Integer fileRevisionID) throws DataAccessException {
      String queryString = "select frc from FileRevisionComment frc join fetch frc.fileRevision fr join fetch frc.user u "
            + "where frc.fileRevision.id = ?";

      List<FileRevisionComment> list = executeQuery(queryString, fileRevisionID);
      return list;
   }
}
